﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;

namespace Sita.Presentation.ViewModels
{
    public class GenericGridList<T> : List<T> where T : class, new()
    {
        private object p;
        private int p_2;
        private int p_3;
        private int TotalRows_2;
        private bool p_4;

        public int PageIndex { get; private set; }
        public int PageSize { get; private set; }
        public int TotalRows { get; private set; }
        public int TotalPages { get; private set; }
        public int PageMin { get; private set; }
        public string SortColumn { get; private set; }

        public SortDirection SortDirection { get; private set; }

        public GenericGridList(IList<T> source, int pageIndex, string sortColumn, int pageSize, int totalRows, bool sortAscending)
        {
            this.AddRange(source);

            PageIndex = pageIndex;
            SortColumn = sortColumn;
            PageSize = pageSize;
            TotalRows = totalRows;
            TotalPages = (int)Math.Ceiling(TotalRows / (double)PageSize);
            SortDirection = sortAscending ? SortDirection.Ascending : SortDirection.Descending;
        }

        public GenericGridList(IList<T> source, int pageIndex, string sortColumn, int pageSize, int totalRows, bool sortAscending, int pageMin)
            : this(source, pageIndex, sortColumn, pageSize, totalRows, sortAscending)
        {
            PageMin = pageMin;
        }

        public GenericGridList(object p, int p_2, string sortColumn, int p_3, int TotalRows_2, bool p_4)
        {
            // TODO: Complete member initialization
            this.p = p;
            this.p_2 = p_2;
            this.SortColumn = sortColumn;
            this.p_3 = p_3;
            this.TotalRows_2 = TotalRows_2;
            this.p_4 = p_4;
        }
    }
}